package JinEChange;

import java.util.Scanner;

public class Change {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入金额");
        int money = sc.nextInt();
        while (true) {
            if(money >= 0 && money <= 9999999){
                break;
            }
            else {
                System.out.println("输入错误，请重新输入");
            }
        }
        String moneyStr = "";
        while (true){
            int ge = money % 10;
            String capitalNumber = getCapitalNumber(ge);
            money = money / 10;
            moneyStr = capitalNumber + moneyStr;
            if(money == 0){
                break;
            }
        }
//        System.out.println(moneyStr);


        int count = 7 - moneyStr.length();
        for (int i = 0; i < count; i++) {
            moneyStr = "零" + moneyStr;
        }
        System.out.println(moneyStr);

        String []arr = {"佰","拾","万","仟","佰","拾","元"};
        String result = "";
        for (int i = 0; i < moneyStr.length(); i++) {
            result = result + moneyStr.charAt(i) + arr[i];
        }
        System.out.println(result);


    }
    public static String getCapitalNumber(int i){
        String []arr = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖",};
        return arr[i];
    }
}
